package com.goddess.yeecolor.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.goddess.yeecolor.Modle.BaoMinInfo;
import com.goddess.yeecolor.R;
import com.goddess.yeecolor.interfaceAll.OnClickListener;
import com.goddess.yeecolor.tools.ImageUtils;
import com.goddess.yeecolor.view.CircleImageView;

import java.util.List;

/**
 * 已报名人数
 */
public class ExerciseItemBaoMinAdapter extends RecyclerView.Adapter<ExerciseItemBaoMinAdapter.ImageHoldeView> {
    private OnClickListener mOnClick;
    private List<BaoMinInfo>mList;
    private Context mContext;

    public ExerciseItemBaoMinAdapter(List<BaoMinInfo>List,Context context){
        this.mList=List;
        this.mContext=context;

    }
    @Override
    public ImageHoldeView onCreateViewHolder(ViewGroup parent, int viewType) {
        View view= LayoutInflater.from(mContext).inflate(R.layout.item_baoming,parent,false);
        ImageHoldeView holdeView=new ImageHoldeView(view);
        return holdeView;
    }

    @Override
    public void onBindViewHolder(ImageHoldeView holder, int position) {

        ImageUtils.getInstance().ImageStart(mContext,mList.get(position).getThumb(),holder.baoming_circler);
//        holder.baoming_circler.setOnClickListener((view -> {
//            int postion=holder.getLayoutPosition();
//            mOnClick.OnClick(view,postion);
//        }));
    }

    @Override
    public int getItemCount() {
        return mList!=null?mList.size():0;
    }

    class ImageHoldeView extends RecyclerView.ViewHolder{
         private CircleImageView baoming_circler;
         public ImageHoldeView(View itemView) {
             super(itemView);
             baoming_circler= (CircleImageView) itemView.findViewById(R.id.baoming_circler);
         }
     }

    public void setOnClickListener(OnClickListener onClickListener){
        this.mOnClick=onClickListener;
    }
}
